package com.ddwl.wallet.dao;

import com.ddwl.schema.bo.wallet.UserSubsidyFlowQueryBo;
import com.ddwl.wallet.dao.mapper.UserSubsidyFlowMapper;
import com.ddwl.wallet.dao.model.UserSubsidyFlow;
import com.ddwl.common.dao.TkDao;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * 用户津贴使用记录(UserSubsidyFlow)数据处理
 *
 * @author zach
 * @since 2020-07-29 17:38:03
 */
@Repository
public class UserSubsidyFlowDao  extends TkDao<UserSubsidyFlowMapper, UserSubsidyFlow> {


    public UserSubsidyFlow getSubsidyFlowBySubsidyId(String subsidyId,String userId){
        UserSubsidyFlow flow = new UserSubsidyFlow();
        flow.setFlowId(subsidyId);
        flow.setUserId(userId);
        return selectOne(flow);
    }


    public List<UserSubsidyFlow> querySubsidyFlow(UserSubsidyFlowQueryBo bo){
        Example example = getExample();
        example.and().andEqualTo("userId",bo.getUserId())
                .andEqualTo("type",bo.getType());
        return baseMapper.selectByExample(example);
    }

}